package org.ice4apps.master.dao;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Enterprise entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "enterprise", catalog = "icemaster", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
public class Enterprise implements java.io.Serializable {
    // Fields
    private String               id;
    private String               name;
    private Long                 features;
    private Long                 creationdate;
    private Long                 updationdate;
    private Set<Organization>    organizations    = new HashSet<Organization> (0);
    private Set<EnterpriseAdmin> enterpriseAdmins = new HashSet<EnterpriseAdmin> (0);

    // Constructors
    /** default constructor */
    public Enterprise () {
    }

    /** minimal constructor */
    public Enterprise (String id, String name, Long creationdate) {
        this.id = id;
        this.name = name;
        this.creationdate = creationdate;
    }

    /** full constructor */
    public Enterprise (String id,
                       String name,
                       Long features,
                       Long creationdate,
                       Long updationdate,
                       Set<Organization> organizations,
                       Set<EnterpriseAdmin> enterpriseAdmins) {
        this.id = id;
        this.name = name;
        this.features = features;
        this.creationdate = creationdate;
        this.updationdate = updationdate;
        this.organizations = organizations;
        this.enterpriseAdmins = enterpriseAdmins;
    }

    // Property accessors
    @Id
    @Column(name = "id", unique = true, nullable = false, length = 36)
    public String getId () {
        return this.id;
    }

    public void setId (String id) {
        this.id = id;
    }

    @Column(name = "name", unique = true, nullable = false, length = 36)
    public String getName () {
        return this.name;
    }

    public void setName (String name) {
        this.name = name;
    }

    @Column(name = "features")
    public Long getFeatures () {
        return this.features;
    }

    public void setFeatures (Long features) {
        this.features = features;
    }

    @Column(name = "creationdate", nullable = false)
    public Long getCreationdate () {
        return this.creationdate;
    }

    public void setCreationdate (Long creationdate) {
        this.creationdate = creationdate;
    }

    @Column(name = "updationdate")
    public Long getUpdationdate () {
        return this.updationdate;
    }

    public void setUpdationdate (Long updationdate) {
        this.updationdate = updationdate;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "enterprise")
    public Set<Organization> getOrganizations () {
        return this.organizations;
    }

    public void setOrganizations (Set<Organization> organizations) {
        this.organizations = organizations;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "enterprise")
    public Set<EnterpriseAdmin> getEnterpriseAdmins () {
        return this.enterpriseAdmins;
    }

    public void setEnterpriseAdmins (Set<EnterpriseAdmin> enterpriseAdmins) {
        this.enterpriseAdmins = enterpriseAdmins;
    }
}